/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.scrumpmt.domain;

import java.util.Collection;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author agumpg
 */
@Entity
@Table(name = "TAREA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tarea.findAll", query = "SELECT t FROM Tarea t"),
    @NamedQuery(name = "Tarea.findById", query = "SELECT t FROM Tarea t WHERE t.id = :id"),
    @NamedQuery(name = "Tarea.findByDes", query = "SELECT t FROM Tarea t WHERE t.des = :des"),
    @NamedQuery(name = "Tarea.findByFecini", query = "SELECT t FROM Tarea t WHERE t.fecini = :fecini"),
    @NamedQuery(name = "Tarea.findByFecfin", query = "SELECT t FROM Tarea t WHERE t.fecfin = :fecfin")})
public class Tarea extends BaseEntity {
    @Column(name = "des", nullable=false)
    private String des;
    @Column(name = "esf", nullable=true)
    private int esf;
    @Column(name = "fecini", nullable=true)
    @Temporal(TemporalType.DATE)
    private Date fecini;
    @Column(name = "fecfin", nullable=true)
    @Temporal(TemporalType.DATE)
    private Date fecfin;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTareaFk")
    private Collection<Esfuerzo> esfuerzoCollection;
    @JoinColumn(name = "id_colaborador_fk", referencedColumnName = "id")
    @ManyToOne(optional = true)
    private Colaborador idColaboradorFk;
    @JoinColumn(name = "id_sprint_fk", referencedColumnName = "id")
    @ManyToOne(optional = true)
    private Sprint idSprintFk;
    @JoinColumn(name = "id_estado_fk", referencedColumnName = "id")
    @ManyToOne(optional = true)
    private Estado idEstadoFk;
    @JoinColumn(name = "id_tiptarea_fk", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private TipoTarea idTiptareaFk;
    @JoinColumn(name = "id_proyecto_fk", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Proyecto idProyectoFk;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTareaFk")
    private Collection<Comentario> comentarioCollection;

    public Tarea() {
    }

    public int getEsf() {
        return esf;
    }

    public void setEsf(int esf) {
        this.esf = esf;
    }
    
    public String getDes() {
        return des;
    }

    public void setDes(String des) {
        this.des = des;
    }

    public Date getFecini() {
        return fecini;
    }

    public void setFecini(Date fecini) {
        this.fecini = fecini;
    }

    public Date getFecfin() {
        return fecfin;
    }

    public void setFecfin(Date fecfin) {
        this.fecfin = fecfin;
    }

    @XmlTransient
    public Collection<Esfuerzo> getEsfuerzoCollection() {
        return esfuerzoCollection;
    }

    public void setEsfuerzoCollection(Collection<Esfuerzo> esfuerzoCollection) {
        this.esfuerzoCollection = esfuerzoCollection;
    }

    public Colaborador getIdColaboradorFk() {
        return idColaboradorFk;
    }

    public void setIdColaboradorFk(Colaborador idColaboradorFk) {
        this.idColaboradorFk = idColaboradorFk;
    }

    public Sprint getIdSprintFk() {
        return idSprintFk;
    }

    public void setIdSprintFk(Sprint idSprintFk) {
        this.idSprintFk = idSprintFk;
    }

    public Estado getIdEstadoFk() {
        return idEstadoFk;
    }

    public void setIdEstadoFk(Estado idEstadoFk) {
        this.idEstadoFk = idEstadoFk;
    }

    public TipoTarea getIdTiptareaFk() {
        return idTiptareaFk;
    }

    public void setIdTiptareaFk(TipoTarea idTiptareaFk) {
        this.idTiptareaFk = idTiptareaFk;
    }

    public Proyecto getIdProyectoFk() {
        return idProyectoFk;
    }

    public void setIdProyectoFk(Proyecto idProyectoFk) {
        this.idProyectoFk = idProyectoFk;
    }

    @XmlTransient
    public Collection<Comentario> getComentarioCollection() {
        return comentarioCollection;
    }

    public void setComentarioCollection(Collection<Comentario> comentarioCollection) {
        this.comentarioCollection = comentarioCollection;
    }

}
